package com.vote.admin.controller;

import com.vote.common.returns.RespEntity;
import com.vote.admin.service.VoteUserResultService;
import com.vote.admin.vo.record.ResultRecord;
import com.vote.admin.vo.result.VoteDetailResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 用户投票系统投票结果页 前端控制器
 * </p>
 *
 * @author gyg
 * @since 2021-05-18
 */
@RestController
@RequestMapping("/user-result")
@Slf4j
@Api(value = "用户投票系统投票结果页", tags = "用户投票系统投票结果页")
public class VoteUserResultController {

    @Resource
    private VoteUserResultService voteUserResultService;

    @GetMapping("/result")
    @ApiOperation(value = "投票活动结果")
    @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "id", value = "投票活动id", required = true)
    public RespEntity<VoteDetailResult<List<ResultRecord>>> getVoteProjectInfo(@RequestParam(value = "id") Integer id) {
        RespEntity<VoteDetailResult<List<ResultRecord>>> respEntity = voteUserResultService.getVoteProjectInfo(id);
        return respEntity;
    }

}
